﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FortuneHeaven.Web.Common;
using FortuneHeavenBAL;

namespace FortuneHeaven.Web.Pages.News
{
    public partial class GameNewsList : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SetPageHeader(FortuneHeavenCommon.Enum.MainPageTabType.news);
            this.usPager.PagerChanged += new Web.Controls.TextPagination.PagerChangeHandler(usPager_PagerChanged);
            if (!IsPostBack)
            {
                ResetList();
            }
        }

        void usPager_PagerChanged(object sender, int currentpage)
        {
            NewsBO gift = new NewsBO();
            rpNews.DataSource = gift.GetNews(this.usPager.CurrentPageIndex, this.usPager.PageSize, FortuneHeavenCommon.Enum.NewsType.Games);
            rpNews.DataBind();
        }

        public void ResetList()
        {
            NewsBO gift = new NewsBO();
            this.usPager.RecordCount = gift.GetTotalSize(FortuneHeavenCommon.Enum.NewsType.Games);
            this.usPager.CurrentPageIndex = 1;
        }
    }
}